/*
 *
编写一个指针函数，把整数45678转化成字符串“456789”
 456789

 */
#include<stdio.h>
#include<assert.h>

char * int_trans_str(char *dest, int num);

int main(){
	int num = 456789;
	char s[100];
	printf("%s\n",int_trans_str(s,num));
}


char * int_trans_str(char *dest, int num){
	assert(dest);
	int i = 0;
	int j = 0;
	while(num != 0){
		dest[j] = num % 10 + 48;
		j++;
		num /= 10;
	}
	dest[j] = '\0';
	//目前是倒序的 再将其翻转下
	j--;
	char tmp;
	while(j>i){
		tmp = dest[i];
		dest[i] = dest[j];
		dest[j] = tmp;
		j--;
		i++;
	}
	return dest;
}
